package com.drawu.drawuspring.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.drawu.drawuspring.domain.po.ActComments;
import com.drawu.drawuspring.mapper.ActCommentsMapper;
import com.drawu.drawuspring.service.IActCommentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 活动评论表[5](@ref) 服务实现类
 * </p>
 *
 * @author hui
 * @since 2025-04-01
 */
@Service
public class ActCommentsServiceImpl extends ServiceImpl<ActCommentsMapper, ActComments> implements IActCommentsService {

    @Override
    public void removeByActId(Long id) {
        remove(Wrappers.<ActComments> lambdaQuery().eq(ActComments::getActivityId, id));
    }

    @Override
    public List<ActComments> queryByActId(Long id) {
        return list(Wrappers.<ActComments> lambdaQuery().eq(ActComments::getActivityId, id).orderByDesc(ActComments::getCreatedAt));
    }
}
